#include <bits/stdc++.h>
using namespace std;
const int N=100005;
int a[N],n;
map<int,int> cnt;
map<int,int> rem;
set<int> st;
/*
cnt: number of attacks
rem: not died
*/
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        st.insert(a[i]);
    }
    for(int i=1;i<=n;i++)
    {
        if(cnt.find(a[i])==cnt.end())
        {
            cnt[a[i]]=1;
            rem[a[i]]=1;
        }
        else
        {
            cnt[a[i]]++;
            rem[a[i]]++;
        }
    }
    vector<int> ary;
    for(auto i:st)
    {
        ary.push_back(i);
    }
    int ans=0;
    for(int i=1;i<ary.size();i++)
    {
        int cur=ary[i];
        if(ans<=cnt[cur])
        {
            
            //all killed
            cnt[cur]-=ans;
            ans=0;

        }
        else
        {
            //kill some
            ans-=cnt[cur];
            cnt[cur]=0;
        }
        ans+=rem[cur];
    }
    
    cout<<ans<<endl;
    return 0;
}